/*
 * Copyright zhoujun 2021 Wicrenet, Inc. All rights reserved.
 */
package com.ruoyi.netty.config;

import com.ruoyi.netty.domain.MsgAgreement;
import com.ruoyi.netty.utils.MsgUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;

/**
 * 【】
 *
 * @author zhoujun
 * Created on 2021/11/25 18:16
 */
@Component
public class MsgPub {

    @Autowired
    private StringRedisTemplate redisTemplate;

    public void pushMessage(String topic, MsgAgreement message) {
        System.out.println("向 "+topic+"发送消息："+message);
        redisTemplate.convertAndSend(topic, MsgUtil.obj2Json(message));
    }
}
